//
//  ProfileCollectionViewCell.m
//  AILove
//
//  Created by 甘世清 on 2023/12/30.
//

#import "ProfileCollectionViewCell.h"

@implementation ProfileCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.backgroundColor = UIColor.clearColor;
        [self.contentView addSubview:self.headerView];
      
        [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.contentView);
        }];
       
        UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleSystemUltraThinMaterialDark];
        self.visualView = [[UIVisualEffectView alloc]initWithEffect:effect];
        self.visualView.frame =CGRectMake(0, 0, 80, 80);
         self.visualView.alpha = 0.94;
         [self.headerView addSubview:self.visualView];
        [self.contentView addSubview:self.suo];
        [self.suo mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.centerY.equalTo(self.contentView);
            make.width.mas_equalTo(20);
            make.height.mas_equalTo(18);
        }];
    }
    return self;
}
- (void)setModel:(ZSModel *)model{
    _model = model;
    if (model.isLock) {
        self.visualView.hidden = NO;
        self.suo.hidden = NO;
    } else {
        self.visualView.hidden = YES;
        self.suo.hidden = YES;
    }
    [self.headerView sd_setImageWithURL:SQURLImage(model.url)];
}
- (UIImageView *)headerView{
    if (!_headerView) {
        _headerView = [[UIImageView alloc]init];
        _headerView.contentMode = UIViewContentModeScaleAspectFill;
        _headerView.layer.cornerRadius = 8;
        _headerView.layer.masksToBounds = YES;
        _headerView.clipsToBounds = YES;
    }
    return _headerView;
}
- (UIImageView *)suo{
    if (!_suo) {
        _suo = [[UIImageView alloc]init];
        _suo.contentMode = UIViewContentModeScaleAspectFit;
        _suo.image = SQGetImage(@"12");
    }
    return _suo;
}
@end
